###############################################################################
# Makefile for the Malloc library.
# $Id: Makefile.all.in,v 1.11 1993/04/06 05:23:08 gray Exp $
###############################################################################

# default root installation directory
prefix = /usr/local

srcdir = @srcdir@
bindir = $(prefix)/bin
libdir = $(prefix)/lib
incdir = $(prefix)/inc
infodir = $(prefix)/info

# default c-compiler
CC = @CC@

DEFS =
INCS = -I$(srcdir)
LIBS = @LIBS@ -L$(srcdir) -lmalloc

LIBRARY	= libmalloc.a
UTIL = malloc_dbg
INFOFILE = malloc.info

CCFLAGS = -g
LDFLAGS = -g

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

###############################################################################
# End of system configuration section.
###############################################################################

SHELL = /bin/sh

HFLS = malloc.h
OBJS = chunk.o compat.o error.o heap.o malloc.o malloc_lp.o malloc_str.o

CFLAGS = $(CCFLAGS)
TESTS = malloc_t

# .PHONY : all
all : $(LIBRARY) $(UTIL)

# .PHONY : clean
clean :
	rm -f a.out core *.o *.t

# .PHONY : clobber
clobber : clean
	rm -f $(LIBRARY) $(TESTS) $(UTIL)

# .PHONY : realclean
realclean : clobber

# .PHONY : distclean
distclean : clobber
	rm -f Makefile conf.h config.status
#	rm -f configure

# .PHONY : install
install : $(HFLS) $(UTIL) $(LIBRARY) $(INFOFILES)
	$(INSTALL_DATA) $(HFLS) $(incdir)
	$(INSTALL_PROGRAM) $(UTIL) $(bindir)
	$(INSTALL_DATA) $(LIBRARY) $(libdir)
	@RANLIB@ $(libdir)/$(LIBRARY)
#	$(INSTALL_DATA) $(INFOFILES) $(infodir)

$(LIBRARY) : $(OBJS)
	ar cr $(LIBRARY) $?
	@RANLIB@ $@
	- chmod 660 $@

$(UTIL) : malloc_dbg.o $(LIBRARY)
	rm -f $@
	$(CC) $(LDFLAGS) $@.o $(LIBS)
	mv a.out $@

# .PHONY : tests
tests : $(TESTS)

malloc_t : malloc_t.o $(LIBRARY)
	rm -f $@
	$(CC) $(LDFLAGS) malloc_t.o $(LIBS)
	mv a.out $@

.c.o :
	rm -f $@
	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o $@

.texi.info :
	makeinfo $<

###############################################################################
#
# These dependencies are automatically generated.  Do not edit by hand.
#

chunk.o : chunk.c malloc.h malloc_loc.h chunk.h chunk_loc.h compat.h conf.h \
  dbg_values.h error.h error_val.h heap.h version.h 
compat.o : compat.c malloc.h malloc_loc.h compat.h conf.h 
error.o : error.c malloc.h malloc_loc.h chunk.h compat.h conf.h dbg_values.h \
  error.h 
heap.o : heap.c malloc.h malloc_loc.h chunk.h compat.h conf.h error.h error_val.h \
  heap.h 
malloc.o : malloc.c malloc.h malloc_loc.h chunk.h compat.h conf.h dbg_values.h \
  error.h error_str.h error_val.h heap.h malloc_lp.h 
malloc_dbg.o : malloc_dbg.c malloc.h malloc_loc.h compat.h conf.h dbg_tokens.h \
  dbg_values.h version.h 
malloc_lp.o : malloc_lp.c malloc.h 
malloc_str.o : malloc_str.c malloc.h malloc_loc.h conf.h chunk.h dbg_values.h \
  error.h malloc_str.h 
malloc_t.o : malloc_t.c malloc.h 
sample.o : sample.c malloc.h 
